#ifndef SCANNERCONTROL_H
#define SCANNERCONTROL_H

#include <QObject>
#include <QMutex>
#include <QSerialPort>
#include <QSerialPortInfo>

#include <QDebug>

class ScannerControl : public QObject
{
    Q_OBJECT

public:

    static ScannerControl* getInstance();
    static ScannerControl* m_instance;
    static QMutex m_mutex;

    /**
     *  扫码枪操作相关函数
     */
    // 设置连接参数
    void set_Connect_Parameters(QString port,
                                QString baudRate,
                                QString dataBit,
                                QString parity,
                                QString stopBit);

    // 连接扫码枪对象
    void connet_To_Device();


private:
    ScannerControl(QObject *parent = nullptr);
    ~ScannerControl();
    ScannerControl(const ScannerControl&)=delete;
    ScannerControl& operator=(const ScannerControl)=delete;

    QSerialPort* m_Serial = nullptr;

signals:

    void scanner_Recv_Data_Signal(QByteArray& sendData);

public slots:

    void recv_Scanner_Result();

    void test_Recv_Slots(QByteArray& recvData);

};

#endif // SCANNERCONTROL_H
